import { KeyEvent } from '@/types'
import { actionsMap } from './actions'
const keyEventMapper = (obj: any): KeyEvent => {
  const defaultKeyEvent = {
    ctrlKey: false,
    shiftKey: false,
    metaKey: false,
    key: '',
    action: '',
  }

  return Object.assign(defaultKeyEvent, obj)
}
export const defaultShortCuts: Array<KeyEvent> = [
  {
    key: ' ',
    action: actionsMap.PLAY_OR_PAUSE,
  },
  {
    key: 'Home',
    action: actionsMap.TO_START,
  },
  {
    key: 'End',
    action: actionsMap.TO_END,
  },
  {
    key: 'ArrowLeft',
    action: actionsMap.PREV_FRAME,
  },
  {
    key: 'ArrowRight',
    action: actionsMap.NEXT_FRAME,
  },
  {
    key: '\\',
    action: actionsMap.SPLIT_CLIP,
  },
  {
    key: 'z',
    action: actionsMap.UNDO,
    ctrlKey: true,
  },
  {
    key: 'y',
    action: actionsMap.REDO,
    ctrlKey: true,
  },
].map(keyEventMapper)
